package tungsten.base.event;
/**
 * 事件的载体
 * @author lv
 *
 */
public class Event 
{
	/**
	 * 事件类型
	 */
	private int type;
	/**
	 * 事件参数
	 */
	private Object[] params;
	
	public Event(int type) 
	{
		this.type = type;
		this.params = null;
	}
	
	public Event(int type,Object...params)
	{
		this.type = type;
		this.params = params;
	}
	
	public Event reset(int type,Object...params)
	{
		this.type = type;
		this.params = params;
		return this;
	}
	
	public Object getParam(int index)
	{
		if(this.params == null || index < 0 || index >= this.params.length)
		{
			return null;
		}
		else
		{
			return this.params[index];
		}
	}
	
	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public Object[] getParams() {
		return params;
	}

	public void setParams(Object[] params) {
		this.params = params;
	}
}
